<#--
/**
 * Copyright 2012 Claude Houle claude.houle@gmail.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-->
<#macro tree nodes>
<#escape x as x?html>
<div id="nav_tree" class="uic-tree uic-disable-user-select">
	<#list nodes as node>
		<div class="uic-tree-node">
			<div class="uic-tree-node-caption <#if node.expanded>uic-tree-node-expanded</#if> <#if node.selected>uic-tree-node-selected</#if>">${node.caption}</div>
			<div class="uic-tree-node-children">
				<#list node.leaves as leaf>
					<a class="uic-tree-leaf <#if node.selected>uic-tree-leaf-selected</#if>" href="${leaf.href}">${leaf.caption}</a>
		   		</#list>
		   	</div>
		</div>
   	</#list>
	<script type="text/javascript">
		$(".uic-tree-node-caption").siblings(".uic-tree-node-children").hide();
		$(".uic-tree-node-expanded").siblings(".uic-tree-node-children").show();
		$(".uic-tree-node-caption").click( function() {
			if( $(this).hasClass("uic-tree-node-expanded") ) {
				$(this).removeClass("uic-tree-node-expanded")
			}else{
				$(this).addClass("uic-tree-node-expanded")
			}
			$(this).siblings(".uic-tree-node-children").toggle();
		});
	</script>
</div>
</#escape>
</#macro>